// 从i个号码中抽取j个号码的组合数
public class LotteryArray {
    public static void main(String[] args) {
        final int NMAX = 10;

        int[][] odds = new int[NMAX+1][];  // 组合数
        for (int i = 0; i <= NMAX; i++) {
            odds[i] = new int[i+1];
        }

        for (int i = 0; i <= NMAX; i++) {
            for (int j = 0; j < odds[i].length; j++) {
                int lotteryOdds = 1;    // 彩票组合数
                for (int k = 1; k <= j; k++) {
                    lotteryOdds = lotteryOdds * (i - k + 1) / k;
                }

                // 从i个号码中抽取j个号码的组合数
                odds[i][j] = lotteryOdds;
            }
        }

        for (int i = 0; i <= NMAX; i++) {
            for (int j = 0; j < odds[i].length; j++) {
                // 打印从i个号码中抽取j个号码的组合数
                System.out.printf("%4d", odds[i][j]);
            }
            System.out.println();
        }
    }
}
